package com.csj.DesignPattern.singleton.demo2;


//静态代码块实现单例
public class Singleton {
    private Singleton() {
    }
    private static Singleton instance;

    static {
        instance = new Singleton();
    }

    // 没有同步锁 会出现重复创建的情况
    public static Singleton getInstance() {
        return instance;
    }
}
